package demo3;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Person {
    /*
    *
    * */
    @Autowired // 自动装配
    @Qualifier("winter")
    private Clothes clothes;
  //  private Shirt shirt;//Person需要使用shirt时,将其定义为一个属性
   // private Sweater sweater; //毛衣
    public void play(){
        //穿上衣服
      //  Shirt shirt = new Shirt(); //不要直接new,产生强耦合，后续可能导致代码修改
   //     shirt.wear();
       // sweater.wear(); //YY2592

        clothes.wear();

        //出去玩
        System.out.println("出去玩！");
    }
}
